<?php

	require_once "ketnoi.php";
	
	date_default_timezone_set('Asia/Ho_Chi_Minh');
	
    $link = ketnoi();
	if($link->connect_error) die("link ket noi die");
    // $database="gilf";
     $database="ztruyen_gilf";
    mysqli_select_db ($link,$database) or die("khong the ket noi csdl");
	$matrungthuong = '133';
	//AND (DATE >= '2015-01-01' and DATE <= '2015-01-20')
	 $getTrungHuongcmd = "SELECT * FROM user WHERE LUCKYNUMBER={$matrungthuong}  AND (DATE >= '2015-01-01' and DATE <= '2015-01-20')  ORDER BY DATE ASC,TIME ASC LIMIT 3";
	//$getTrungHuongcmd = "select * from user";
	$arrRecord = mysqli_query($link,$getTrungHuongcmd) or die("die cmnr");
	//print_r($arrRecord);
	//$row = array(); 
	// while($row = mysqli_fetch_array($arrRecord))
	// {
		// $rows[] = $row;
		// echo $row["UID"]."<br>";

	// }

	
	
	//echo $getTrungHuongcmd;
?>



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />	
<meta property="og:title" content="Khai trương GameToy Shop Nhận quà miễn phí"/>
<meta property="og:site_name" content="GameToy shop" />
<meta property="og:image" content="https://dochoigame.com/faceApp/images/logo4.jpg" />
<meta property="og:image:width" content="200">
<meta property="og:image:height" content="200">
<title>Lucky Some!</title>
<style>
	body{
		font-family:Arial, Helvetica, sans-serif;
		}
	table{
		border:1px solid green;
		}
	table td{
		border:1px solid green;
		padding:10px;
		color:#3300FF;
		}
</style>
</head>

<body>
<h1 align="center"><font color="#FF0000">KẾT QUẢ DỰ ĐOÁN GAMETOY SHOP<br>TỪ (11/1/2015 - 17/1/2015)</font><h1>
<table align="center" width="700">
<tr >
    <td style="color:#36C;font-weight:bold;" width="20%">THÔNG TIN</td>
    <td style="color:#36C;font-weight:bold;" width="20%">SỐ MAY MẮN</td>
	<td style="color:#36C;font-weight:bold;" width="20%">THỜI GIAN CHỌN SỐ</td>
</tr>
<?php 
		$rs=0;
		$rs=mysqli_num_rows($arrRecord);
		if($rs == 0)
			return;
		while($rs=mysqli_fetch_array($arrRecord))
		{
			$luckyDayStr = date("d-m-Y", strtotime($rs["DATE"]) );
	
			
	echo '<tr>
        <td width="40%"><a href="'.$rs["LINK"].'"target="_blank" </a>'.$rs["FIRST_NAME"] .' '.$rs["LAST_NAME"].'</td>
        <td width="20%">'.$rs["LUCKYNUMBER"].'</td>
		<td width="40%">'.$luckyDayStr.' - '.$rs["TIME"].'</td>
    </tr>';
	
}
?>
</table>
</body>
</html>